﻿@model PagedList.IPagedList<Tag>
@using QAS.Nekorama.Models
@using Resources
@using PagedList.Mvc
@{
    ViewBag.Title = QAS_Nekorama.TAGS;
}
<div id="primary">
    <div id="primary-1">
    </div><!--end primary-1-->
    <div id="primary-2">
        <div id="tag-list">
            <!--SEARCH BAR-->
            <div class="search-bar">
                <!--Header Search-->
                @using (Html.BeginForm("Index", "Tag", FormMethod.Get, new {@id = "search"}))
                {
                    @Html.TextBox("SearchTagString", null, new {id = "searchtag", placeholder = QAS_Nekorama.SEARCH_BY_KEYWORD})
                }
            </div><!--end search-bar-->
            <!--END SEARCH BAR-->
            <!--TAG LIST-->
            @{
                int count = 0;
                int flag = 0;
                int tagNumber = 0;
                foreach (Tag t in Model)
                {
                    tagNumber++;
                }
            }

            @foreach (Tag item in Model)
            {
                if (count%4 == 0)
                {
                    @:<div class="t-row">
                    flag = count;
                }

                <div class="tag-info">
                    @Html.ActionLink("#" + item.TagName, "Index", "Question", new {searchString = "#" + item.TagName + ": "}, null)
                    <br />
                    <p><a target="_blank" href="@Html.Raw(QAS_Nekorama.WIKI_LINK + item.TagName)">@QAS_Nekorama.READ_DEF_ON_WIKI</a></p>
                </div>
                <!--end tag-info-->

                count++;
                if (count%4 == 0)
                {
                    if (count != flag)
                    {
                        @:</div><!--end row-->
                    }
                }
                else if (count == tagNumber)
                {
                    @:</div><!--end row-->
                }
            }
            <div id="page-number">
                @Html.PagedListPager(Model, page => Url.Action("Index", new {page, currentFilter = ViewBag.CurrentFilter}))
            </div><!--end page-number-->
            <!--END TAG LIST-->
        </div><!--end tag-list-->
    </div><!--end primary-2-->
    <div id="primary-3">
    </div>
    <!--end primary-3-->
</div><!--end primary-->